#__Author__  = white

import sys
import time


for i in range(20):
    sys.stdout.write("#") #标准写入
    sys.stdout.flush()    #将内存的内容强制刷新在硬盘中
    time.sleep(0.1)


f = open("file","r+",encoding="utf-8")  #读写模式
#f.write("\nthis is a beauitful girl\n")
#f.seek(10)
#print(f.seek(10))    #将光标返回到下标为10的位置
#print(f.tell())      #打印当前光标位置
#print(f.readline())

f_new = open("file_bak","w+",encoding="utf-8")

for i in f:
    f_new.write(i)

f_new.seek(0)
for i in f_new:
    print(i)
f.seek(0)
for line in f:
    if  "girl" in  line:
        line = line.replace("girl"," boy")
    f.write(line)


f_new.seek(0)
for i in f_new:
    print(i)
              